<%@ page language="java" import="java.util.*,SiTuQingYou.vo.*,SiTuQingYou.util.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%String path = request.getContextPath();%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>思途轻游-跟团游 </title>
    <style type="text/css">
     .yemian{margin-top:30px;margin-left:50px;}
     #title{width:100%;height:100px;line-height:100px;color:darkcyan;margin-top:30px;text-align:center;}
     .pager a{
       display:inline-block;
       width:35px;
       height:35px;
       background-color:gray;
       color:white;
       text-align:center;
       line-height:35px;
       border-radius:18px;
       text-decoration:none;
      }
       .pager a.cur{
       background-color:green;
       }
       
       .sc{width:1200px;height:250px;margin-top:35px;}
       .pic img{width:250px;height:250px;}
       .pic{float:left;}
       .neirong{width:946px;height:250px;float:left;background-color:#ddd;}
       
       .tit{height:40px;font-size:22px;font-weight:600;padding-left:40px;color:#2F4F4F;}
       .price{height:40px;padding-left:40px;font-size:25px;font-weight:900;color:red;}
       .pactime{height:30px;padding-left:40px;font-size:18px;font-weight:500;}
       .people{height:25px;padding-left:40px;font-size:15px;}
       .info{height:115px;padding-left:40px;font-size:15px;overflow:auto;color:SlateGray;}
       
       
    </style>
</head>
<body>
      <jsp:include page="header.jsp"></jsp:include>
      <div id="title">
            <font face="隶书" size="10px"><a style="text-decoration:none;color:darkcyan;" href="<%=path %>/index/index.jsp">跟团游</a></font>
      </div>
      
      
      <jsp:include page="/PackageTourServlet"><jsp:param value="showAllPackageTour" name="method"/></jsp:include>
           <%
           ArrayList<PackageTour> pat  = (ArrayList<PackageTour>)request.getAttribute("pat");
           Pager pager = (Pager) request.getAttribute("pager");
           %>
      
           <%
           String tobook = request.getParameter("tobook");
           if("1".equals(tobook)){%>
           <script type="text/javascript">
        	   alert("成功预订一位！如需预定多人请再次点击按钮");
           </script>
           <%} %>
     
     
     
     
      <div class="yemian">
           <script type="text/javascript">
               var currentdate = new Date();
               var y = currentdate.getFullYear();//获得当前年份
               var m = currentdate.getMonth()+1;//获得当前月份
               var d = currentdate.getDate();//获得当前日期
           </script>
           
           <%for(PackageTour p:pat){ %>
           <div class="sc">
               <!-- 旅游团图片 -->
               <div class="pic">
                   <img class="tupian" src="<%=path%>/packageImage/<%=p.getPhoto()%>">
               </div>
              
               <div class="neirong">     
                 <!-- 旅游团主题 -->
                 <div class="tit">
                      <%=p.getTitle() %>
                 </div>
                 
                 <!-- 价格 -->
                 <div class="price">
                                                  ￥<%=p.getPrice() %>
                    <a style="font-size:20px;border-radius:8px;background-color:#D3D3D3;width:60px;"
                     href="javascript:if(confirm('确定报名吗?'))
                     location='<%=path %>/PackageTourServlet?method=addToCart&id=<%=p.getId() %>'">立即预订</a>
                 </div>
                 
                 <!-- 团期 -->
                 <div class="pactime">
                                                        发团时间：<%=p.getPacktime() %>
                 <%
                    int year = Integer.parseInt((p.getPacktime()+"").split(" ")[0].split("-")[0]);
                    int month = Integer.parseInt((p.getPacktime()+"").split(" ")[0].split("-")[1]);
                    int day = Integer.parseInt((p.getPacktime()+"").split(" ")[0].split("-")[2]);
                 %>
                 <span id="chufa" style="color:orange;font-weight:600;">
                  <script type="text/javascript">
                       
                  
                       if(y==<%=year%>&&m==<%=month%>&&d==<%=day-1%>){
                           document.write("<font color='red'>明日出发</font>");
                       }
                       
                       if(y==<%=year%>&&m==<%=month%>&&d!=<%=day-1%>){
               	           var sub = <%=day%>-d;
                           document.write("本月出发，距离出发还有"+sub+"天");
                       }
                       
                       if(y==<%=year%>&&m==<%=month-1%>){
                    	   document.write("<font color='green'>下月出发</font>");
                    	  
                       }
                       
                  </script>
                 </span>                                   
                                                                                
                                                     
                  
                 </div>
                 
                 <!-- 人数 -->
                 <div class="people">
                                                         本团参考人数：<%=p.getPeople() %>
                 </div>
             
             
                 <!-- 详情 -->
                 <div class="info">
                    <%=p.getInfomation() %>
                 </div>
               </div> 
           </div>    
           <%} %>
           
           <!-- 显示页码 -->
           <div class="pager">
           <%
           for(int i=1;i<=pager.getPageCount();i++)
           {%>
              <a href="<%=path%>/index/packagetour.jsp?pageNum=<%=i%>" class=<%=(i==pager.getPageNum()?"cur":"")%>><%=i%></a>
           
           <%}%>
                          共<%=pager.getPageCount() %>页   共<span id="HowManyData"><%=pager.getDataCount() %></span>记录
           </div>
      
      </div>
      <jsp:include page="footer.jsp"></jsp:include>
</body>
</html>
